﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WF_DepartmentManagement.aspx.cs" MasterPageFile="~/index.Master" Inherits="xManagerWebApp.AdminCompany.WF_DepartmentManagement" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
        <fieldset>
        <legend>Add new department</legend>
        <p>
        <label>Specify a name:</label>

        <asp:TextBox ID="tb_dep_name" runat="server"></asp:TextBox>
        </p>
        <p>
        <asp:Button ID="save" runat="server" Text="Add" OnClick="SaveDepartment" CssClass="form button fright" />    
        <asp:Label ID="save_status" runat="server" Text=""></asp:Label>
        </p>
        
        
        </fieldset>
        
        
        <fieldset>
        <legend>Current departments</legend>
        
        
        <asp:Repeater ID="DepartmentList" runat="server">
            <HeaderTemplate>
                <div class="clearfix table_head">
                    <div class="span-7">Name</div>                    
                    <div class="span-3 last">Delete ?</div>                    
                </div>
                <div class="clearfix table">
            </HeaderTemplate>
            
            <ItemTemplate>            
                <div class="table_row">
                        <div class="span-7"><%# Eval("Name")%></div>
                        <div class="span-3 last">                        
                           <asp:Button ID="XXX" runat="server" OnClick="delete_dep" CommandArgument='<%# Eval("Id") %>' Text="Yes" />
                        </div>
                </div>            
            </ItemTemplate>
            <FooterTemplate></div></FooterTemplate>     
        </asp:Repeater>  
        
        
        
        
        <asp:PlaceHolder ID="dep_list" runat="server"></asp:PlaceHolder>
        
        
        </fieldset>
        
        
        <fieldset>
        <legend>Add new department levels</legend>
        
        <p><label>Choose a department:</label>  <asp:DropDownList ID="drop_down_department_list" runat="server" AutoPostBack="true" OnSelectedIndexChanged="UpdateLevelList"></asp:DropDownList></p>
        <p>
        <label>Name:</label><asp:TextBox ID="tb_level_name" runat="server"/>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="tb_level_name" Display="Dynamic" ErrorMessage="Não pode ficar vazio" ValidationGroup="DEP_LEVEL_GROUP"></asp:RequiredFieldValidator>
        </p>
        <p>
        <label>Level:</label><asp:TextBox ID="tb_level_level" runat="server" MaxLength="1" Width="35px" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tb_level_level" Display="Dynamic" ErrorMessage="Não pode ficar vazio" ValidationGroup="DEP_LEVEL_GROUP"></asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator ID="rev" runat="server" ControlToValidate="tb_level_level" Enabled="false" Display="Dynamic" ValidationExpression="/d{1}" ErrorMessage="Numero entre [0..9]" ValidationGroup="DEP_LEVEL_GROUP"></asp:RegularExpressionValidator>
        </p>
        
        <p><asp:Button ID="Button1" runat="server" Text="Add" OnClick="SaveLevel" ValidationGroup="DEP_LEVEL_GROUP" CssClass="form button" /></p>
        
        <br />
        <fieldset>
        <legend>Department levels for the department chosen</legend>    
        
        
        <br />
        
        <asp:Repeater ID="DepartmentLevelList" runat="server">
            <HeaderTemplate>
                <div class="clearfix table_head">
                    <div class="span-6">Name</div>
                    <div class="span-3">Level</div>
                    <div class="span-3 last">Delete ?</div>                    
                </div>
                <div class="clearfix table">
            </HeaderTemplate>
            
            <ItemTemplate>            
                <div class="table_row">
                        <div class="span-6"><%# Eval("Name")%></div>
                        <div class="span-3"><%# Eval("Level")%></div>
                        <div class="span-3 last">                        
                        <asp:Button ID="XXX" runat="server" OnClick="delete_dep_level" 
                        CommandArgument='<%# Eval("Id") %>' Text="Yes" />
                        </div>
                </div>            
            </ItemTemplate>
            <FooterTemplate></div></FooterTemplate>     
        </asp:Repeater>
        </fieldset>
        </fieldset>
        
</asp:Content>

